//
//  TabeBarViewController.swift
//  DouyuTV
//
//  Created by apple on 2017/7/3.
//  Copyright © 2017年 apple. All rights reserved.
//

import UIKit

class TabeBarViewController: UITabBarController {
    var  tabbarBgimg:UIImageView?
    
    var tabbarimgSelected:UIImageView?
    
    override func viewDidLoad() {
        super.viewDidLoad()

    self.setupAllChildviewController()
    }
    func setupAllChildviewController() {
        
        self.setupOneChildViewController(viewController: ViewController(), image: UIImage.init(named: "btn_home_normal_24x24_")!, selectedImage: UIImage.init(named: "btn_home_selected_24x24_")!, title: "首页")
        self.setupOneChildViewController(viewController: LiveViewController(), image: UIImage.init(named: "btn_live_normal_24x24_")!, selectedImage: UIImage.init(named: "btn_live_selected_24x24_")!, title: "直播")
        self.setupOneChildViewController(viewController: GZViewController(), image: UIImage.init(named: "btn_gz_normal_24x24_")!, selectedImage: UIImage.init(named: "btn_gz_selected_24x24_")!, title: "关注")
        
        self.setupOneChildViewController(viewController:SearchViewController(), image: UIImage.init(named: "btn_search_normal")!, selectedImage: UIImage.init(named: "btn_search_selected")!, title: "发现")
        
        self.setupOneChildViewController(viewController: MineViewController(), image: UIImage.init(named: "tabMine_24x24_")!, selectedImage: UIImage.init(named: "tabMineHL_24x24_")!, title: "我的")
        
        
        
        
        
        
    }
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()

    }
    func setupOneChildViewController(viewController : UIViewController,image:UIImage,selectedImage:UIImage,title : String){
        
        let navc = UINavigationController.init(rootViewController: viewController)
        
        UITabBarItem .appearance().setTitleTextAttributes([NSForegroundColorAttributeName: UIColor.orange], for: .selected)
        
        navc.tabBarItem = UITabBarItem.init(title: title, image: image, selectedImage: selectedImage.withRenderingMode(.alwaysOriginal))
        self.addChildViewController(navc)
}

}
